//
//  XSSetViewController.m
//  MeiLiYiChu
//
//  Created by mac on 16/3/3.
//  Copyright © 2016年 mac. All rights reserved.
//

#import "XSSetViewController.h"

@interface XSSetViewController ()<UITableViewDataSource,UITableViewDelegate>

@end

@implementation XSSetViewController
-(void)viewWillAppear:(BOOL)animated
{
    self.navigationController.navigationBarHidden =YES;
    
}
- (void)viewDidLoad {
    [super viewDidLoad];
    
    XSView * view =[[XSView alloc]initWithBool:NO withString:@"设置"];
    [self.view addSubview:view];
    
    
    UITableView * _table =[[UITableView alloc]initWithFrame:self.view.bounds style:UITableViewStyleGrouped];
    _table.delegate =self;
    _table.dataSource =self;
    _table.rowHeight =44;
    [self.view addSubview:_table];
    
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 3;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    if (section ==2)
    {
        return 2;
    }
    else if (section ==0)
    {
        return 2;
    }
    
    return 1;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString * CellIndetifi =@"Cell";
    UITableViewCell * cell =[tableView dequeueReusableCellWithIdentifier:CellIndetifi];
    if (!cell) {
        cell =[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIndetifi];
    }
    cell.accessoryType =UITableViewCellAccessoryDisclosureIndicator;
    if (indexPath.section ==0) {
        if (indexPath.row ==0) {
            cell.textLabel.text =@"新人有礼";
        }
        else
        {
            cell.textLabel.text =@"修改密码";
        }
        
    }
    else if (indexPath.section ==1)
    {
        cell.textLabel.text =@"常见问题解答";
    }
    else
    {
        if (indexPath.row ==0)
        {
//            cell.textLabel.text =[NSString stringWithFormat:@"清空本地图片缓存 %ldM",]
            
        }
        else
        {
            cell.textLabel.text =@"关于";
        }
    }
    
    return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.section ==0) {
        if (indexPath.row ==0)
        {
           //新人有利
        }
        else
        {
            
        }
        
    }
    else if (indexPath.section ==1)
    {
        
    }
    else
    {
        if (indexPath.row ==0)
        {
            //清空缓存
            //            cell.textLabel.text =[NSString stringWithFormat:@"清空本地图片缓存 %ldM",]
        }
        else
        {
            
        }
    }

}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
